<?php
/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Touch
 * @copyright  Copyright Hire-Experts LLC
 * @license    http://www.hire-experts.com
 * @version    $Id: default.tpl 2011-04-26 11:18:13 mirlan $
 * @author     Mirlan
 */

?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-touch10.dtd">

<?php
$locale = $this->locale ()->getLocale ()->__toString ();
$orientation = 'ltr';
?>
<html xmlns="http://www.w3.org/1999/xhtml"
	xml:lang="<?php
	echo $locale?>" lang="<?php
	echo $locale?>">
<head>
<base
	href="<?php
	echo rtrim ( (constant ( '_ENGINE_SSL' ) ? 'https://' : 'http://') . $_SERVER ['HTTP_HOST'] . $this->baseUrl (), '/' ) . '/'?>" />

  <?php // ALLOW HOOKS INTO META 		?>
  <?php
		echo $this->touchHeadTranslate ();
		?>

	<?php // TITLE/META 	?>
	<?php
	$counter = ( int ) $this->layout ()->counter;
	
	$request = Zend_Controller_Front::getInstance ()->getRequest ();
	$this->headTitle ()->setSeparator ( ' - ' );
	$pageTitleKey = 'pagetitle-' . $request->getModuleName () . '-' . $request->getActionName () . '-' . $request->getControllerName ();
	$pageTitle = $this->translate ( $pageTitleKey );
	if ($pageTitle && $pageTitle != $pageTitleKey) {
		$this->headTitle ( $pageTitle, Zend_View_Helper_Placeholder_Container_Abstract::PREPEND );
	}
	$this->headTitle ( $this->translate ( $this->layout ()->siteinfo ['title'] ), Zend_View_Helper_Placeholder_Container_Abstract::PREPEND );
	$this->headMeta ()->appendHttpEquiv ( 'Content-Type', 'text/html; charset=UTF-8' )->appendHttpEquiv ( 'Content-Language', 'en-US' );
	
	// Make description and keywords
	$description = '';
	$keywords = '';
	
	$description .= ' ' . $this->layout ()->siteinfo ['description'];
	$keywords = $this->layout ()->siteinfo ['keywords'];
	
	if ($this->subject () && $this->subject ()->getIdentity ()) {
		$this->headTitle ( $this->subject ()->getTitle () );
		
		$description .= ' ' . $this->subject ()->getDescription ();
		if (! empty ( $keywords ))
			$keywords .= ',';
		$keywords .= $this->subject ()->getKeywords ( ',' );
	}
	
	$this->headMeta ()->appendName ( 'description', trim ( $description ) );
	$this->headMeta ()->appendName ( 'keywords', trim ( $keywords ) );
	
	// Get body identity
	if (isset ( $this->layout ()->siteinfo ['identity'] )) {
		$identity = $this->layout ()->siteinfo ['identity'];
	} else {
		$identity = $request->getModuleName () . '-' . $request->getControllerName () . '-' . $request->getActionName ();
	}
	?>
	<?php
	echo $this->headTitle ()->toString () . "\n"?>
	<?php
	echo $this->headMeta ()->toString () . "\n"?>
	<meta
	content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"
	name="viewport">
	
  <?php // LINK/STYLES 		?>
  <?php
		$this->headLink ( array ('rel' => 'favicon', 'href' => '/favicon.ico', 'type' => 'image/x-icon' ), 'PREPEND' );
		
		$themes = array ();
		if (null !== ($theme = $this->touchActiveTheme ())) {
			$themes = array ($theme );
		} else {
			$themes = array ('default' );
		}
		?>
  <?php
		echo $this->headLink ()->toString () . "\n"?>
  <?php
		echo $this->headStyle ()->toString () . "\n"?>

	<style type="text/css">
<?
php
 
echo
 
$
this-
>
		activeTouchThemeStyles ( $counter );
		
		?>
</style>
	
  <?php
		echo $this->touchScript ( $this->baseUrl () . '/externals/mootools/mootools-1.2.4-core-yc.js?c=' . $counter );
		echo $this->touchScript ( $this->baseUrl () . '/externals/mootools/mootools-1.2.4.4-more-yc.js?c=' . $counter );
		echo $this->touchScript ( $this->baseUrl () . '/externals/chootools/chootools.js?c=' . $counter );
		echo $this->touchScript ( $this->baseUrl () . '/application/modules/Core/externals/scripts/core.js?c=' . $counter );
		echo $this->touchScript ( $this->baseUrl () . '/application/modules/User/externals/scripts/core.js?c=' . $counter );
		echo $this->touchScript ( $this->baseUrl () . '/application/modules/Suggest/externals/scripts/core.js?c=' . $counter );
		
		//Touch Scripts
		echo $this->touchScript ( $this->baseUrl () . '/application/modules/Touch/externals/scripts/hecore.js?c=' . $counter );
		echo $this->touchScript ( $this->baseUrl () . '/application/modules/Touch/externals/scripts/ajax.js?c=' . $counter );
		echo $this->touchScript ( $this->baseUrl () . '/application/modules/Touch/externals/scripts/form.js?c=' . $counter );
		echo $this->touchScript ( $this->baseUrl () . '/application/modules/Touch/externals/scripts/confirm.js?c=' . $counter );
		echo $this->touchScript ( $this->baseUrl () . '/application/modules/Touch/externals/scripts/multiselect.js?c=' . $counter );
		echo $this->touchScript ( $this->baseUrl () . '/application/modules/Touch/externals/scripts/picup.js?c=' . $counter );
		echo $this->touchScript ( $this->baseUrl () . '/application/modules/Touch/externals/scripts/smoothbox.js?c=' . $counter );
		echo $this->touchScript ( $this->baseUrl () . '/application/modules/Touch/externals/scripts/photobox.js?c=' . $counter );
		echo $this->touchScript ( $this->baseUrl () . '/application/modules/Touch/externals/scripts/core.js?c=' . $counter );
		
		//Touch Modules
		echo $this->touchScript ( $this->baseUrl () . '/application/modules/Touch/modules/Activity/externals/scripts/core.js?c=' . $counter );
		echo $this->touchScript ( $this->baseUrl () . '/application/modules/Touch/externals/calendar/calendar.compat.js?c=' . $counter );
		echo $this->touchScript ( $this->baseUrl () . '/application/modules/Touch/modules/Like/externals/scripts/core.js?c=' . $counter );
		echo $this->touchScript ( $this->baseUrl () . '/externals/flowplayer/flashembed-1.0.1.pack.js?c=' . $counter );
		?>
<?php // SCRIPTS 
		?>

<script type="text/javascript">
	Date.setServerOffset('<?php
	echo date ( 'D, j M Y G:i:s O', time () )?>');

	en4.orientation = '<?php
	echo $orientation?>';
	en4.core.environment = '<?php
	echo APPLICATION_ENV?>';
	en4.core.language.setLocale('<?php
	echo $this->locale ()->getLocale ()->__toString ()?>');
	en4.core.setBaseUrl('<?php
	echo $this->url ( array (), 'default', true )?>');
	en4.core.loader = new Element('img', {src: 'application/modules/Core/externals/images/loading.gif'});
	en4.core.siteTitle = "<?php
	echo Engine_Api::_ ()->getApi ( 'settings', 'core' )->__get ( 'core_general_site_title', $this->translate ( '_SITE_TITLE' ) )?>";
  Touch.referrerFavicon = "<?php
		echo (file_exists ( APPLICATION_PATH . '/favicon.ico' ) ? 'http://' . $_SERVER ['HTTP_HOST'] . $this->baseUrl () . '/' . 'favicon.ico' : '');
		?>";


	<?php
	if ($this->subject ()) :
		?>
		en4.core.subject = {
			type : '<?php
		echo $this->subject ()->getType ();
		?>',
			id : <?php
		echo $this->subject ()->getIdentity ();
		?>,
			guid : '<?php
		echo $this->subject ()->getGuid ();
		?>'
		};
	
	<?php endif;
	?>

	<?php
	if ($this->viewer ()->getIdentity ()) :
		?>
		en4.user.viewer = {
			type : '<?php
		echo $this->viewer ()->getType ();
		?>',
			id : <?php
		echo $this->viewer ()->getIdentity ();
		?>,
			guid : '<?php
		echo $this->viewer ()->getGuid ();
		?>'
		};
	
	<?php endif;
	?>

	if( <?php
	echo (Zend_Controller_Front::getInstance ()->getRequest ()->getParam ( 'ajax', false ) ? 'true' : 'false')?> ) {
		en4.core.dloader.attach();
	}

  <?php
		echo $this->headTranslate ()->render ()?>
</script>

</head>

<body
	id="global_page_<?php
	echo $request->getModuleName () . '-' . $request->getControllerName () . '-' . $request->getActionName ()?>"
	class="touch-body">

<div id="global_bind"><!-- Start of Boxes -->

<div id="global_photo_box">
<div id="photo_box_header"><a href="javascript://" id="photo_box_close"><?php
echo $this->translate ( "TOUCH_Back to Album" );
?></a>
</div>

<div id="photo_box_loading" class="photo-loading"><img
	src="application/modules/Touch/externals/images/line_loading.gif"
	border="0" alt="<?php
	echo $this->translate ( 'Loading' ) . '...';
	?>" />
</div>

<div id="photo_box_photo" class="photo-body"></div>

<div class="photo-navigators" id="photo_box_navigators">
<div id="photo_box_prev" class="photo-prev"></div>
<div id="photo_box_middle" class="photo-middle"></div>
<div id="photo_box_next" class="photo-next"></div>
</div>

</div>

<div id="global_smooth_box"><button class="smooth-close"
	onclick="Smoothbox.close()"><?php
	echo $this->translate ( 'close' );
	?></button>
<div id="smooth-body" class="smooth-body"></div>
<div class="loader" id="smooth-loading"><?php
echo $this->translate ( 'Loading ...' );
?></div>
</div>

<!-- End of Boxes -->

<div id="global_header">
    <?php
				echo $this->touchContent ( 'header' )?>
  </div>

<div id='global_wrapper'>
<div id="global_content_loading"><a class="loader"><?php
echo $this->translate ( "Loading ..." );
?></a></div>

<div id='global_content' style="display: none">
      <?php
						echo $this->layout ()->content?>
    </div>
</div>

<div id="global_footer">
    <?php
				echo $this->touchContent ( 'footer' )?>
  </div>

</div>
</body>
</html>